<?php
class Ubigeo extends AppModel {
	var $name = 'Ubigeo';
	
	var $belongsTo = array('Estado'=>array('className' => 'Estado','foreignKey' => 'estado_id'));
	
	function countUbigeo($params){
		return $this->find('count',$params);
	}
	function dataUbigeo($params){
		return $this->find('all',$params);
	}
	
	function getUbigeoLista(){
		$ubigeoLista =  $this->find('all',array(
							'fields'=>array('Ubigeo.id',
							'"Ubigeo"."distrito" || \', \' || "Ubigeo"."provincia" || \', \' || "Ubigeo"."departamento" AS "Ubigeo__ubigeo"'),
							'conditions'=>array('Ubigeo.estado_id = '=>1)));
		
		foreach($ubigeoLista as $ubigeo){
			$ubigeo_tmp[$ubigeo['Ubigeo']['id']] = $ubigeo['Ubigeo']['ubigeo'];
		}
		return $ubigeo_tmp;
	}
}